package com.levy.contronller.jvm.classLoader;

import java.util.Random;

/**
 * 当一个接口在初始化时，并不要求父接口都完成了初始化
 * 只有在真正使用到父接口的时候（如引入接口中所定义的常量时），才会初始化
 */
public class MyTest5 {

    public static void main(String[] args) {
//        System.out.println(MyChild5.a);

        System.out.println("--------------");
//        MyChild5_1 myChild5_1 = new MyChild5_1();
        System.out.println(MyChild5_1.b);

    }


}

interface MyParent5 {
    public static int a = new Random().nextInt();
}

interface MyChild5 extends MyParent5 {
    int b = 5;
}

interface MyGrandpa {

    public static int g = 8;
    public static Thread thread = new Thread() {
        {
            System.out.println("MyGrandpa invoked");
        }
    };
}

interface MyParent5_1 extends MyGrandpa {
    public static Thread thread = new Thread() {
        {
            System.out.println("MyParent5_1 invoked");
        }
    };
}

class MyChild5_1 implements MyParent5_1 {
    static {
        System.out.println("mychild5_q invoked");
        b = 3;
    }
    public static int b = 4;

}